// SKATmovingwindow.cpp : Defines the entry point for the console application.


#include "SKATmovingwindow.h"
#include <iostream>
#include <fstream>

int main(int argc, char* argv[])
{
    // parameters are parsed and stored in argument
	CommandParser* argument = new CommandParser(argc, argv);
	
	// reads map file
	MapFileReader* readmap = new MapFileReader(argument->mapvalue);

	// generates SetID file using .map file
	
	if (strcmp(argument->modevalue,"physical") == 0){
		SetID_pos* newwindow = new SetID_pos(readmap->get_mapvec(), atoi(argument->windowvalue), atoi(argument->stepvalue));
		newwindow->print_all(argument->mapvalue);
	}
	else if (strcmp(argument->modevalue,"marker") == 0){
		SetID_SNP* newwindow = new SetID_SNP(readmap->get_mapvec(), atoi(argument->windowvalue), atoi(argument->stepvalue));
		newwindow->print_all(argument->mapvalue);
	}
	else if (strcmp(argument->modevalue,"gene") == 0){
		GeneFileReader* readgene = new GeneFileReader(argument->genelistvalue);
		SetID_Gene* newwindow = new SetID_Gene(readmap->get_mapvec(),readgene->get_genevec());
		newwindow->print_all(argument->mapvalue);
	}
	// generates R script
	RScriptGenerator* rs = new RScriptGenerator(argument);
	rs->generateScript();

	return 0;
}